package AggregationMethod;

import java.util.ArrayList;

import Definitions.NodeClass;
import Sampling.SamplingAbstractClass;

/*****************************************************************
* Name : WeighthedAverageMethod
* Aim : This class aims to keep the methods for the WeighthedAverageMethod Neighborhood 
* Calculation Function type and inherited from the NeighbourhoodFunction *
* * Algorithms: 1 2 3 0 5 -> 1*classRatioOfclass1 / 11 , 2*classRatioOfclass2 / 11, ...
*****************************************************************/
public class WeighthedAverageMethodClass extends NeighbourhoodFunctionAbstractClass 
{

	WeighthedAverageMethodClass(SamplingAbstractClass currentSampling){
		super(currentSampling);
		// TODO Auto-generated constructor stub
		name="WeightedAverageMethod";
	}
	/*****************************************************************
	* Function Name: 	weightedAverageMethod
	* Aim: 				perform the weightedAverageMethod
	* Inputs: 			ArrayList<Node> node : The neighbors that will be used for the method
	* 					int usePredictOrActual : Predicted Classes or actual classes will be used 
	* 											when choosing neighbors
	* Outputs: 			sumList
	* Data Structures:  ---
	* Algorithms: 		---
	*****************************************************************/
	public ArrayList<Double> getAggregatedNeighbourVector(ArrayList<NodeClass> nodeList) 
	{
		ArrayList<Double> countOfEdges=new ArrayList<Double>();
		double totalNeighbour=nodeList.size(); 

		countOfEdges= this.countEdge(nodeList);
		if(totalNeighbour==0)
		    	return countOfEdges;	
		for(int i=0; i<countOfEdges.size(); i++)
		{
			double sum= countOfEdges.get(i);
			countOfEdges.set(i,  global.classList.get(i).getRatio()*sum/totalNeighbour);
		}
		
		
		return countOfEdges;
	}
}
